<?php

class Log_model extends CI_Model {
    /*
     * 创建日志
     */
    public function createLog($table,$data){
        $this->db->insert($table,$data);
        return $this->db->affected_rows()?true:false;
    }
    /*
     * 查询日志
     */
    public function getLog($table,$where){
        $query = $this->db->select('*')->where($where)->order_by('id DESC')->get($table);
        return $query->result_array();
    }
    /*
     * 删除日志(根据id)
     */
    public function delLog($table,$where,$type=1){
        if($type==1){
          $state = $this->db->where($where)->delete($table);  
        } else {
          $state = $this->db->where_in('id', $where)->delete($table); 
        }
        return $state;
    }

   

}
